<template>
  <div class="home">
    <van-nav-bar title="黑马程序员" />
    <van-swipe :autoplay="3000">
      <van-swipe-item v-for="(image, index) in images" :key="index">
        <img :src="image.img" class="imge" />
      </van-swipe-item>
    </van-swipe>
    <div class="middle">
      <div @click="$router.push({path:'/NewsList'})">
        <i class="iconfont icon-dingwei" style="background: #1fd59a;"></i>
        <p>新闻资讯</p>
      </div>
      <div @click="$router.push({path:'Imglist'})">
        <i class="iconfont icon-dian" style="background:#fd3b4f"></i>
        <p>图片分享</p>
      </div>
      <div @click="$router.push({path:'/GoodsList'})">
        <i class="iconfont icon-gouwuche" style="background:#3f80fe"></i>
        <p>商品展示</p>
      </div>
    </div>

    <div class="mdllebuttom">
      <div>
        <i class="iconfont icon-liuyan" style="background:#2bc2f7"></i>
        <p>留言反馈</p>
      </div>
      <div>
        <i class="iconfont icon-sousuo" style="background:#fd3f00"></i>
        <p>搜索资讯</p>
      </div>
      <div>
        <i class="iconfont icon-list_icon" style="background:#ff772b"></i>
        <p>联系我们</p>
      </div>
    </div>
  </div>
</template>

<script>
import { homegetLunbo } from "../../apis/home";

export default {
  data() {
    return {
      images: [],
    };
  },
  //  获取图片数据
  async mounted() {
    let res = (await homegetLunbo()).data.message;
    console.log(res);
    this.images = res;
  },
};
</script>
<style lang="less" scoped>
@import url("//at.alicdn.com/t/font_2621987_b0ynohisk4i.css");
.imge {
  width: 100%;
  height: 100%;
}

p {
  margin-top: 10px;
  text-align: center;
}
.middle,
.mdllebuttom {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-top: 20px;
  padding: 0 20px;
  div i {
    display: inline-block;
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 30px;
  }
  i {
    color: #fff;
    border-radius: 25px;
    text-align: center;
  }
}
</style>